package org.example;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.regex.Pattern;

@SpringBootApplication
@RestController
public class Application {
    public static boolean containsUpperCase(String str) {
        Pattern pattern = Pattern.compile("[A-Z]");
        return pattern.matcher(str).find();
    }

    public static boolean containsLowerCase(String str) {
        Pattern pattern = Pattern.compile("[a-z]");
        return pattern.matcher(str).find();
    }

    public static boolean containsDigit(String str) {
        Pattern pattern = Pattern.compile("[0-9]");
        return pattern.matcher(str).find();
    }

    public static boolean containsSpecialChar(String str) {
        // 这里定义了特殊字符的范围，您可以根据需要进行调整
        Pattern pattern = Pattern.compile("[^a-zA-Z0-9]");
        return pattern.matcher(str).find();
    }

    public static boolean checkStringComplexity(String str) {
        return  containsSpecialChar(str);
    }
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
        String testString = "qweQ123";
        boolean isComplex = checkStringComplexity(testString);
        if(isComplex == false){
            System.out.println("1"+isComplex);
        }else {
            System.out.println("2"+isComplex);
        }

    }

 /*  @Autowired
    ConfigurableApplicationContext applicationContext;
    @Value("$(common.name)")
    private String config1;

    @GetMapping("/configs")
    public String getConfigs(){
       // return config1;
        return applicationContext.getEnvironment().getProperty("common.name");

    }*/


    /*
     * 图片的展示
     */
    public void images(){
        System.out.println("这是一个图片的image");
    }

}
